/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.rationalsheet.parser.type;

/**
 *
 * @author Overmind
 */
public abstract class Type<T>
    implements Comparable<Type>
{
    public static final String CAST_ERROR = "#CAST_ERROR#";
    
    private String name;
    
    protected Type(String name)
    {
        this.name = name;
    }
    
    public String getName()
    {
        return name;
    }
    
    public abstract T valueOfString(String string) throws NumberFormatException;
    
    public abstract String objectToString(T value);

    @Override
    public int compareTo(Type right)
    {
        return getName().compareTo(right.getName());
    }

    @Override
    public String toString()
    {
        return name;
    }
    
    
}
